/* WordPet - Child-Friendly CSS Styles */

/* Base styles */
:root {
  --primary-color: #4285f4;
  --secondary-color: #34a853;
  --accent-color: #fbbc05;
  --error-color: #ea4335;
  --success-color: #34a853;
  --background-color: #ffffff;
  --text-color: #202124;
  --child-friendly-blue: #8ab4f8;
  --child-friendly-green: #66bb6a;
  --child-friendly-yellow: #fdd663;
  --child-friendly-pink: #f8bbd0;
  --border-radius: 12px;
  --touch-target-size: 48px; /* Minimum 44px for accessibility */
  --font-size-large: 18px;
  --font-size-normal: 16px;
  --font-size-small: 14px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#app {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 20px;
}

h1 {
  color: var(--child-friendly-blue);
  font-size: 2.5rem;
  margin: 0;
  text-align: center;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
}

h2 {
  color: var(--primary-color);
  font-size: 1.8rem;
  text-align: center;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
}

h3 {
  color: var(--child-friendly-green);
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
}

/* Screen system */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* Buttons - Large touch targets for children */
.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 10px auto;
  padding: 16px 24px;
  font-size: var(--font-size-large);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  text-align: center;
  font-weight: bold;
  transition: all 0.2s ease;
  min-height: var(--touch-target-size);
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 8px rgba(66, 133, 244, 0.3);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: #3367d6;
  transform: scale(1.02);
  box-shadow: 0 6px 12px rgba(66, 133, 244, 0.4);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
  box-shadow: 0 4px 8px rgba(52, 168, 83, 0.3);
}

.btn-secondary:hover, .btn-secondary:focus {
  background-color: #2e8b47;
  transform: scale(1.02);
  box-shadow: 0 6px 12px rgba(52, 168, 83, 0.4);
}

/* Disabled button styles */
.btn-primary:disabled, .btn-secondary:disabled {
  opacity: 0.5;
  background-color: #cccccc;
  color: #666666;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-primary:disabled:hover, .btn-primary:disabled:focus,
.btn-secondary:disabled:hover, .btn-secondary:disabled:focus {
  background-color: #cccccc;
  transform: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Player XP display */
#player-xp-display {
  background-color: #e8f0fe;
  border-radius: var(--border-radius);
  padding: 15px;
  margin-bottom: 20px;
  text-align: center;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#player-xp-display h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.xp-stats {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

.xp-stat {
  background-color: white;
  padding: 8px 15px;
  border-radius: 20px;
  margin: 5px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Sentence puzzle styles */
#sentence-puzzle-container {
  text-align: center;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sentence-words-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  min-height: 100px;
}

.word-tile {
  padding: 12px 16px;
  background-color: var(--child-friendly-blue);
  border: 2px solid #a0c4ff;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  font-size: var(--font-size-large);
  font-weight: bold;
  min-width: 60px;
  min-height: var(--touch-target-size);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.word-tile:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.word-tile:active {
  transform: scale(0.95);
  background-color: #6a94e0; /* Visual feedback when clicked */
}

.word-pronunciation-active {
  animation: pronunciationActive 0.5s ease-in-out;
  background-color: var(--child-friendly-yellow);
  color: #333;
}

@keyframes pronunciationActive {
  0% { transform: scale(1); box-shadow: 0 0 0 3px rgba(253, 214, 99, 0.5); }
  50% { transform: scale(1.1); box-shadow: 0 0 10px 5px rgba(253, 214, 99, 0.8); }
  100% { transform: scale(1); box-shadow: 0 0 0 3px rgba(253, 214, 99, 0.5); }
}

.word-tile.correct {
  background-color: var(--success-color);
  color: white;
}

.word-tile.incorrect {
  background-color: var(--error-color);
  color: white;
}

.sentence-display {
  font-size: var(--font-size-large);
  margin: 20px 0;
  padding: 15px;
  background-color: #f1f8ff;
  border-radius: var(--border-radius);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.1);
}

.sentence-word {
  display: inline-block;
  padding: 8px 12px;
  margin: 4px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sentence-word:hover {
  background-color: #e8f0fe;
  transform: scale(1.05);
}

.sentence-word:active {
  background-color: #d0e0ff; /* Visual feedback when clicked */
  transform: scale(0.95);
}

/* Pet display */
#pet-display {
  text-align: center;
  margin: 20px 0;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Container for pet and player avatars side by side */
.avatars-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 30px;
  width: 100%;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 150px;
}

.avatar-label {
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--primary-color);
  font-size: 1.2rem;
}

.pet-avatar, .player-avatar {
  width: 150px;
  height: 150px;
  background-color: var(--child-friendly-pink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 4rem; /* Increased font size for bigger emojis */
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.3s ease, background-color 0.3s ease;
}

/* Responsive design for smaller screens */
@media (max-width: 600px) {
  .avatars-container {
    flex-direction: column;
    gap: 20px;
  }
  
  .avatar-section {
    width: 100%;
  }
  
  .pet-avatar, .player-avatar {
    width: 100px;
    height: 100px;
    font-size: 3rem;
  }
}

.pet-avatar.level-up {
  animation: petLevelUp 0.6s ease-in-out;
}

@keyframes petLevelUp {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.pet-avatar.growth-pulse {
  animation: growthPulse 1s infinite alternate;
}

@keyframes growthPulse {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

.pet-info {
  text-align: center;
}

.pet-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 15px;
  width: 100%;
  max-width: 400px;
}

.pet-stat {
  background-color: var(--child-friendly-yellow);
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Player stats */
#player-stats {
  text-align: center;
  margin: 20px 0;
  padding: 15px;
  background-color: #e8f0fe;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Player avatar styling when displayed in player-stats section */
.player-avatar-inline {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 4rem;
  border-radius: 50%;
  background-color: var(--child-friendly-blue);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-item {
  display: flex;
  justify-content: space-around;
  margin: 10px 0;
  flex-wrap: wrap;
}

.stat {
  display: block;
  margin: 5px 10px;
  padding: 8px 15px;
  background-color: white;
  border-radius: 20px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-low {
  background-color: #ffebee;
  color: #c62828;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Feedback messages */
#feedback-container {
  margin: 20px 0;
  text-align: center;
  min-height: 60px;
}

.feedback-message {
  padding: 15px;
  border-radius: var(--border-radius);
  font-size: var(--font-size-large);
  font-weight: bold;
  margin: 10px 0;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: relative;
}

.feedback-message-text {
  margin-bottom: 10px;
}

.feedback-translation {
  font-size: var(--font-size-normal);
  font-weight: normal;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-style: italic;
  margin-top: 8px;
  border: 1px solid rgba(66, 133, 244, 0.3);
}

.feedback-success {
  background-color: #e6f4ea;
  color: var(--success-color);
  border: 1px solid #80cc74;
  animation: feedbackSuccessPulse 0.5s ease-in-out;
}

@keyframes feedbackSuccessPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.feedback-error {
  background-color: #fce8e6;
  color: var(--error-color);
  border: 1px solid #ff6f61;
}

/* Home buttons container */
#home-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 30px;
  gap: 15px;
}

/* Pet care panel */
#pet-care-display {
  text-align: center;
  margin: 20px 0;
  padding: 20px;
  background-color: #f1f8ff;
  border-radius: var(--border-radius);
}

#pet-care-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

/* Game controls */
#game-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#game-controls .btn-primary,
#game-controls .btn-secondary {
  width: 100%;
  max-width: 250px;
  margin: 5px auto;
}

/* Settings panel */
.settings-panel {
  max-width: 500px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
}

.setting-item {
  margin: 15px 0;
  padding: 10px 0;
}

.setting-label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

.setting-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: var(--font-size-normal);
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Responsive design */
@media (max-width: 600px) {
  #app {
    padding: 10px;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .btn-primary, .btn-secondary {
    max-width: 100%;
    padding: 14px 20px;
  }
  
  .pet-stats {
    grid-template-columns: 1fr;
  }
}